<html style="height: 100%">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />
    <link rel="stylesheet" href="/wxconf/css/weui.min.css">
	<link rel="stylesheet" href="/wxconf/css/jquery-weui.min.css">
	<script type="text/javascript" src="/wxconf/js/vue.min.js"></script>
    <title>管家帮</title>
</head>

<body style="height: 100%" >
	<header class='demos-header'>
      <h1 class="demos-title">管家帮</h1>
    </header>
	
	<div class="weui-grids">
      <a href="javascript:void(0)"  onclick="gopay()" class="weui-grid js_grid">
        <div class="weui-grid__icon">
          <img src="images/icon_nav_button.png" alt="">
        </div>
        <p id="app" class="weui-grid__label" >
          	支付{{ openid }}
        </p>
      </a>
    </div>
	 
	 <img alt="" src="/wxconf/sanpay" >

<script type="text/javascript" src="/wxconf/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="/wxconf/js/jquery-1.11.0.js?123"></script>
<script type="text/javascript" src="/wxconf/js/jquery-weui.min.js"></script>
<script type="text/javascript" src="/wxconf/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/wxconf/js/wx_clc.js"></script>
<script type="text/javascript">


	var exampleData = {
			openid : $.cookie('openid'),
			userinfo : $.cookie('userinfo')
	}
	// 创建一个 Vue 实例或 "ViewModel"
	// 它连接 View 与 Model
	new Vue({
	    el: '#app',
	    data: exampleData
	})
	
	var clc = new wx_clc({
		debug : true
	});

	clc.config("/wxconf/jsTicket");
    
	function gopay(){
		$.ajax({
			type:"post",
			url:"/wxconf/pay",
			data:{},
			dataType:"json",
			success:function(data){
				wx.chooseWXPay({
					timestamp : data.data.timeStamp, // 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
					nonceStr : data.data.nonceStr, // 支付签名随机串，不长于 32 位
					package : data.data.package, // 统一支付接口返回的prepay_id参数值，提交格式如：prepay_id=\*\*\*）
					signType : data.data.signType, // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
					paySign : data.data.paySign, // 支付签名
					success : function(res) {
						alert(res.err_msg);
					}
				});
				
			}
		});
	}
	
	 wx.error(function(res){
         alert(res.err_msg);
         return false;
     });
	
</script>
</body>
</html>